/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tal.drivechain.gui;

import java.awt.Color;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import javax.swing.BorderFactory;
import javax.swing.JFrame;

/**
 *
 * @author Tal Eisenberg
 */
public class GUIPopup extends JFrame {
    protected boolean closeOnLostFocus = true;

    public GUIPopup(Color c) {
        this.addWindowFocusListener(new WindowFocusListener() {

            public void windowGainedFocus(WindowEvent e) {}

            public void windowLostFocus(WindowEvent e) {
                if (closeOnLostFocus) GUIPopup.this.setVisible(false);
            }
        });
        this.setBackground(Color.BLACK);
        this.setUndecorated(true);
        this.getRootPane().setBorder(BorderFactory.createLineBorder(c));
    }

    public void setColor(Color c) {
        this.getRootPane().setBorder(BorderFactory.createLineBorder(c));
    }
}
